<script setup>
	const props = defineProps({
		info: Object,
	})
</script>

<template>
	<view class="prescription-page">
		<view class="prescription">
			<view class="prescription-header">
				<view class="header">
					<text class="title">电子处方</text>
					<navigator url="" class="nav">
						<text class="origin">原始处方</text>
						<uni-icons type="right" size="16" color="#6f6f6f"></uni-icons>
					</navigator>
				</view>
				<view class="patient-info">
					{{ props.info.name }} {{ props.info.genderValue }}
					{{ props.info.age }}岁 {{ props.info.diagnosis }}</view
				>
				<view class="time"> 开方时间：{{ props.info.createTime }}</view>
			</view>
			<view class="content">
				<view
					class="list-item"
					v-for="medicine in props.info.medicines"
					:key="medicine.id"
				>
					<view class="info">
						<text class="name">{{ medicine.name }}</text>
						<text class="size">85ml</text>
						<text class="number">x{{ medicine.quantity }}</text>
					</view>
					<view class="desc">
						<text>{{ medicine.usageDosag }}</text>
					</view>
				</view>
			</view>
		</view>
		<navigator
			class="prescription-btn"
			hover-class="none"
			:url="`/subpkg_medicine/payment/index?prescriptionId=${props.info.id}`"
			>购买药品</navigator
		>
	</view>
</template>

<style lang="scss">
	.prescription-page {
		margin-top: 60rpx;
		.prescription {
			background-color: #fff;
			padding: 30rpx;
			border-radius: 30rpx;

			.prescription-header {
				padding-bottom: 20rpx;
				border-bottom: 1px solid #fbfbfb;
				.header {
					display: flex;
					justify-content: space-between;
					align-items: center;
					.title {
						font-size: 36rpx;
					}
					:deep(.navigator-wrap) {
						display: flex;
						align-items: center;
					}
					.origin {
						color: #6f6f6f;
						font-size: 26rpx;
					}
				}
				.patient-info,
				.time {
					line-height: 2;
					color: #6f6f6f;
					font-size: 26rpx;
				}
			}
			.content {
				margin-top: 20rpx;
				.list-item {
					display: flex;
					flex-direction: column;
					.info {
						display: flex;
						flex: 1;
						justify-content: space-between;
						font-size: 32rpx;
					}
					.desc {
						color: #6f6f6f;
						font-size: 26rpx;
						line-height: 2;
					}
				}
			}
		}
		.prescription-btn {
			height: 100rpx;
			line-height: 100rpx;
			text-align: center;
			color: #7bd3b8;
			background-color: #ebf9f7;
		}
	}
</style>
